import 'package:flutter/material.dart';

class MyApp7 extends StatelessWidget {
  const MyApp7({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      //导航条
      appBar: AppBar(
        title: const Text(
          'image组件',
          style: TextStyle(color: Colors.white, fontSize: 20),
        ),
        backgroundColor: Colors.pink,
        centerTitle: true,
      ),
      //加载网络图片
      // body: Center(
      //   child: Container(
      //     width: 250,
      //     height: 400,
      //     color: Colors.amberAccent,
      //     child: Image.network(
      //       'https://img2.baidu.com/it/u=897477102,83240605&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
      //       fit: BoxFit.contain,
      //     ),
      //   ),
      // ),

      //加载本地图片
      body: Center(
        child: Container(
          width: 200,
          height: 200,
          color: Colors.tealAccent,
          child: Image.asset('qiche.png'),
        ),
      ),
    );
  }
}
